home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI Developer Toolbox 6.1
/
SGI Developer Toolbox 6.1 - Disc 1.iso
/
toolbox
/
src
/
exampleCode
/
opengl
/
defrasterPort
/
defi.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-11-11
|
3KB
|
104 lines
/*
* Copyright (c) 1994, Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that the name of Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
* INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE
* POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* OpenGL(TM) is a trademark of Silicon Graphics, Inc.
*/
/*
* Example showing how to render a defrasterfont with irisGL
*
* Yusuf Attarwala
*
* cc defi.c -o defi -lgl
*
*/
#include <gl.h>
static int test_width = 33;
static int test_height = 33;
unsigned short test_raster[] = {
0x000f, 0xf000, 0x0000,
0x0010, 0x0800, 0x0000,
0x0060, 0x0600, 0x0000,
0x0180, 0x0180, 0x0000,
0x0600, 0x0060, 0x0000,
0x0800, 0x0010, 0x0000,
0x0803, 0xc010, 0x0000,
0x100f, 0xf008, 0x0000,
0x1038, 0x1c08, 0x0000,
0x2060, 0x0604, 0x0000,
0x2080, 0x0104, 0x0000,
0x4000, 0x0002, 0x0000,
0x8000, 0x0001, 0x0000,
0x8003, 0xc001, 0x0000,
0x8003, 0xc001, 0x0000,
0x8001, 0x8001, 0x0000,
0x8000, 0x0001, 0x0000,
0x8000, 0x0001, 0x0000,
0x8070, 0x0e01, 0x0000,
0x8070, 0x0e01, 0x0000,
0x8070, 0x0e01, 0x0000,
0x4070, 0x0e02, 0x0000,
0x2000, 0x0004, 0x0000,
0x2000, 0x0004, 0x0000,
0x1000, 0x0008, 0x0000,
0x1000, 0x0008, 0x0000,
0x0800, 0x0010, 0x0000,
0x0800, 0x0010, 0x0000,
0x0600, 0x0060, 0x0000,
0x01ff, 0xff80, 0x0000,
0x007f, 0xfe00, 0x0000,
0x001f, 0xf800, 0x0000,
0x000f, 0xf000, 0x0000};
#define EXAMPLEFONT 1
#define efont_nc 100
#define efont_nr (sizeof(test_raster)/sizeof(unsigned short))
main()
{
Fontchar fchar[efont_nc];
prefposition(10,210,10,210);
winopen("irisGL defraster");
winconstraints();
color(0);
clear();
fchar['a'].offset = 0;
fchar['a'].w = test_width;
fchar['a'].h = test_height;
fchar['a'].xoff = 0;
fchar['a'].yoff = 0;
fchar['a'].width = test_width;
defrasterfont(EXAMPLEFONT,test_height,efont_nc,fchar,efont_nr,test_raster);
font(EXAMPLEFONT);
ortho2(0.0,200.0,0.0,200.0);
color(7);
cmov2i(20,20);
charstr("a");
sleep(5);
exit();
}